<?php

// Login page //
// will be a part of "index" //

// Loading libraries
require_once('lib_load.php');
load_lib(array('DbMysql', 'User'));

$user = new User();

if (isset($_POST['LLogin'],$_POST['LPassword'],$_POST['LSend']))
{
    $pass = $db->GetValue('users', 'password', 'login = \''.mysql_real_escape_string($_POST['LLogin']).'\'');
    if (!empty($pass)) // well, you don't realy need it, but... 
    {	
        if($pass == md5($_POST['LPassword']))
        {
            $user->Auth($_POST['LLogin'] , $_POST['LPassword']);
            echo '/succs shadows.php'; // login successful, redirecting
            exit;
        }
        else
            echo 'Sorry, the identifier/password combination you\'ve entered is invalid.';
    }
    else
        echo 'Sorry, the identifier/password combination you\'ve entered is invalid.';

}
else
{
    // Loadfing the infomation in main_buffer
    $main_buf = implode('',file('templates/index.htm'));
    $reg_buf = implode('',file('templates/data/login/index.htm'));
    $main_buf=str_replace("[%INFO%]",$reg_buf ,$main_buf);

    // main info output
    echo $main_buf;
}


?>